winsafe\taskschd\com_interfaces/
itrigger.rs

1#![allow(non_camel_case_types, non_snake_case)]
2
3use crate::co;
4use crate::decl::*;
5use crate::ole::privs::*;
6use crate::prelude::*;
7use crate::taskschd::vts::*;
8
9com_interface! { ITrigger: "09941815-ea89-4b5b-89e0-2a773801fac3";
10	/// [`ITrigger`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nn-taskschd-itrigger)
11	/// COM interface.
12	///
13	/// Automatically calls
14	/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
15	/// when the object goes out of scope.
16}
17
18impl oleaut_IDispatch for ITrigger {}
19impl taskschd_ITrigger for ITrigger {}
20
21/// This trait is enabled with the `taskschd` feature, and provides methods for
22/// [`ITriggerCollection`](crate::ITriggerCollection).
23///
24/// Prefer importing this trait through the prelude:
25///
26/// ```no_run
27/// use winsafe::prelude::*;
28/// ```
29pub trait taskschd_ITrigger: oleaut_IDispatch {
30	/// [`ITrigger::get_Enabled`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_enabled)
31	/// method.
32	#[must_use]
33	fn get_Enabled(&self) -> HrResult<bool> {
34		let mut enabled = i16::default();
35		ok_to_hrresult(unsafe { (vt::<ITriggerVT>(self).get_Enabled)(self.ptr(), &mut enabled) })
36			.map(|_| enabled != 0)
37	}
38
39	fn_com_bstr_get! { get_EndBoundary: ITriggerVT;
40		/// [`ITrigger::get_EndBoundary`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_endboundary)
41		/// method.
42	}
43
44	fn_com_bstr_get! { get_ExecutionTimeLimit: ITriggerVT;
45		/// [`ITrigger::get_ExecutionTimeLimit`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_executiontimelimit)
46		/// method.
47	}
48
49	fn_com_bstr_get! { get_Id: ITriggerVT;
50		/// [`ITrigger::get_Id`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_id)
51		/// method.
52	}
53
54	fn_com_bstr_get! { get_StartBoundary: ITriggerVT;
55		/// [`ITrigger::get_StartBoundary`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_startboundary)
56		/// method.
57	}
58
59	/// [`ITrigger::get_Type`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-get_type)
60	/// method.
61	#[must_use]
62	fn get_Type(&self) -> HrResult<co::TASK_TRIGGER_TYPE2> {
63		let mut ty = co::TASK_TRIGGER_TYPE2::default();
64		ok_to_hrresult(unsafe { (vt::<ITriggerVT>(self).get_Type)(self.ptr(), ty.as_mut()) })
65			.map(|_| ty)
66	}
67
68	/// [`ITrigger::put_Enabled`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-put_enabled)
69	/// method.
70	fn put_Enabled(&self, enabled: bool) -> HrResult<()> {
71		ok_to_hrresult(unsafe { (vt::<ITriggerVT>(self).put_Enabled)(self.ptr(), enabled as _) })
72	}
73
74	fn_com_bstr_set! { put_EndBoundary: ITriggerVT, end;
75		/// [`ITrigger::put_EndBoundary`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-put_endboundary)
76		/// method.
77	}
78
79	fn_com_bstr_set! { put_ExecutionTimeLimit: ITriggerVT, time_limit;
80		/// [`ITrigger::put_ExecutionTimeLimit`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-put_executiontimelimit)
81		/// method.
82	}
83
84	fn_com_bstr_set! { put_Id: ITriggerVT, id;
85		/// [`ITrigger::put_Id`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-put_id)
86		/// method.
87	}
88
89	fn_com_bstr_set! { put_StartBoundary: ITriggerVT, start;
90		/// [`ITrigger::put_StartBoundary`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-itrigger-put_startboundary)
91		/// method.
92	}
93}